package com.example.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.pojo.goodproductQuestionlistPojo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.glassfish.jaxb.runtime.v2.runtime.output.SAXOutput;

import java.util.List;

/**
 * ClassName:goodproductQuestionlistMapp
 * Package:com.example.mapper
 * Description:
 *
 * @Author：牧星苑
 * @Create 2025/7/4 14:13
 * @Version 1.0
 */
@Mapper
public interface goodproductQuestionlistMapp {
    //向数据库中写入问题清单，写入数据
    @DS("newMscLowCodeFormal")
    @Insert("insert into ddm_goodproduct_questionlist(" +
            "id, create_time, update_time, " +
            "creator, process_status, sys_update_user, " +
            "sys_audit_user, sys_audit_time, sys_deleted, " +
            "question_classification, question_source, source_classification, " +
            "department, question_description, generation_time, " +
            "correct_person, correct_time)" +
            "VALUES(" +
            "#{id}, #{create_time}, #{update_time}, " +
            "#{creator}, #{process_status}, #{sys_update_user}, " +
            "#{sys_audit_user}, #{sys_audit_time}, #{sys_deleted}, " +
            "#{question_classification}, #{question_source}, #{source_classification}, " +
            "#{department}, #{question_description}, #{generation_time}, " +
            "#{correct_person}, #{correct_time})")
    void insertOne(goodproductQuestionlistPojo question);

    //查询问题清单中所有的数据
    @DS("newMscLowCodeFormal")
    //*代表所有字段
    @Select("select * from ddm_goodproduct_questionlist where sys_deleted=0 or sys_deleted is null " +
            "order by generation_time DESC")
    List<goodproductQuestionlistPojo> queryAll();

    //根据ID，选择一行数据
    @DS("newMscLowCodeFormal")
    @Select("select * from ddm_goodproduct_questionlist where id=#{id}")
    goodproductQuestionlistPojo selectById(String id);

    //根据IdUse编辑某一行数据
    //指定数据库
    @DS("newMscLowCodeFormal")
    //更新哪些字段的数据
    @Update("update ddm_goodproduct_questionlist " +
            "set " +
            "id=#{id}, " +
            "create_time=#{create_time}, " +
            "update_time=#{update_time}, " +
            "creator=#{creator}, " +
            "process_status=#{process_status}, " +
            "sys_update_user=#{sys_update_user}, " +
            "sys_audit_user=#{sys_audit_user}, " +
            "sys_audit_time=#{sys_audit_time}, " +
            "sys_deleted=#{sys_deleted}, " +
            "question_classification=#{question_classification}, " +
            "question_source=#{question_source}, " +
            "source_classification=#{source_classification}, " +
            "department=#{department}, " +
            "question_description=#{question_description}, " +
            "generation_time=#{generation_time}, " +
            "correct_person=#{correct_person}, " +
            "correct_time=#{correct_time} " +
            "where id=#{id}")
    void editOneByIdUse(goodproductQuestionlistPojo pojo);
}
